package com.zxx.pattern.observerPattern.observer2;

import java.util.Observable;
import java.util.Observer;

/**
 * 自定义的观察者
 * 实现了JAVA内置的观察者接口Observer和自定义的展示接口IDisplay
 *
 * @author zxx on 2021/3/9
 */
public abstract class CustomObserver implements Observer, IDisplay {

    protected String name;

    @Override
    public void update(Observable subject, Object thing) {
        System.out.println(this.name + "收到了消息：" + thing.toString());
        display();
    }

}



